import java.util.Scanner;

public class Test {
    //倒置字符串
    // public static void main(String[] args) {
    //     Scanner scanner = new Scanner(System.in);
    //     String str = scanner.nextLine();
    //     StringBuilder stringBuilder = new StringBuilder();
    //     int cur = str.length() - 1;
    //     while(cur >= 0){
    //         int prev = cur;
    //         while (prev != 0 && str.charAt(prev) != ' '){
    //             prev--;
    //         }
    //         String tmp = str.substring(prev,cur + 1);
    //         stringBuilder.append(tmp);
    //         stringBuilder.append(" ");
    //         cur = prev - 1;
    //     }
    //     String ret = stringBuilder.toString();
    //     for (int i = 1; i < ret.length() - 1; i++) {
    //             if(ret.charAt(i) == ' ' && ret.charAt(i+1) == ' '){
    //                 continue;
    //             }
    //             System.out.print(ret.charAt(i));
    //     }
    //
    // }


    //点击消除
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] chars = scanner.next().toCharArray();
        StringBuilder ret = new StringBuilder();
        for(int i = 0;i < chars.length;i++){
            if (!ret.isEmpty() && chars[i] == ret.charAt(ret.length() - 1)){
                //模拟出栈
                ret.deleteCharAt(ret.length() - 1);
            }
            else{
                //模拟进栈
                ret.append(chars[i]);
            }

        }
        System.out.println(ret.length() == 0 ? 0 : ret.toString());
    }
}
